package model

import (
	"blog-server/global"

	"github.com/pkg/errors"
)

func Models() []interface{} {
	return []interface{}{
		&Article{},
		&ArticleTag{},
		&Tag{},
	}
}

func AutoMigrate() error {
	err := global.DBEngine.AutoMigrate(Models()...)
	if err != nil {
		return errors.WithStack(err)
	}
	return nil
}
